home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / net / RCS / route.h,v < prev   
Encoding:
Text File  |  1988-06-29  |  3.0 KB  |  131 lines

  1. head     1.2;
  2. access   ;
  3. symbols  ;
  4. locks    ; strict;
  5. comment  @ * @;
  6.  
  7.  
  8. 1.2
  9. date     88.06.29.15.14.24;  author ouster;  state Exp;
  10. branches ;
  11. next     1.1;
  12.  
  13. 1.1
  14. date     88.06.21.16.56.39;  author ouster;  state Exp;
  15. branches ;
  16. next     ;
  17.  
  18.  
  19. desc
  20. @@
  21.  
  22.  
  23. 1.2
  24. log
  25. @Add ifdefs so files won't be processed twice.
  26. @
  27. text
  28. @/*
  29.  * Copyright (c) 1980, 1986 Regents of the University of California.
  30.  * All rights reserved.
  31.  *
  32.  * Redistribution and use in source and binary forms are permitted
  33.  * provided that this notice is preserved and that due credit is given
  34.  * to the University of California at Berkeley. The name of the University
  35.  * may not be used to endorse or promote products derived from this
  36.  * software without specific prior written permission. This software
  37.  * is provided ``as is'' without express or implied warranty.
  38.  *
  39.  *    @@(#)route.h    7.3 (Berkeley) 12/30/87
  40.  */
  41.  
  42. #ifndef _ROUTE
  43. #define _ROUTE
  44.  
  45. /*
  46.  * Kernel resident routing tables.
  47.  * 
  48.  * The routing tables are initialized when interface addresses
  49.  * are set by making entries for all directly connected interfaces.
  50.  */
  51.  
  52. /*
  53.  * A route consists of a destination address and a reference
  54.  * to a routing entry.  These are often held by protocols
  55.  * in their control blocks, e.g. inpcb.
  56.  */
  57. struct route {
  58.     struct    rtentry *ro_rt;
  59.     struct    sockaddr ro_dst;
  60. };
  61.  
  62. /*
  63.  * We distinguish between routes to hosts and routes to networks,
  64.  * preferring the former if available.  For each route we infer
  65.  * the interface to use from the gateway address supplied when
  66.  * the route was entered.  Routes that forward packets through
  67.  * gateways are marked so that the output routines know to address the
  68.  * gateway rather than the ultimate destination.
  69.  */
  70. struct rtentry {
  71.     u_long    rt_hash;        /* to speed lookups */
  72.     struct    sockaddr rt_dst;    /* key */
  73.     struct    sockaddr rt_gateway;    /* value */
  74.     short    rt_flags;        /* up/down?, host/net */
  75.     short    rt_refcnt;        /* # held references */
  76.     u_long    rt_use;            /* raw # packets forwarded */
  77.     struct    ifnet *rt_ifp;        /* the answer: interface to use */
  78. };
  79.  
  80. #define    RTF_UP        0x1        /* route useable */
  81. #define    RTF_GATEWAY    0x2        /* destination is a gateway */
  82. #define    RTF_HOST    0x4        /* host entry (net otherwise) */
  83. #define    RTF_DYNAMIC    0x10        /* created dynamically (by redirect) */
  84. #define    RTF_MODIFIED    0x20        /* modified dynamically (by redirect) */
  85.  
  86. /*
  87.  * Routing statistics.
  88.  */
  89. struct    rtstat {
  90.     short    rts_badredirect;    /* bogus redirect calls */
  91.     short    rts_dynamic;        /* routes created by redirects */
  92.     short    rts_newgateway;        /* routes modified by redirects */
  93.     short    rts_unreach;        /* lookups which failed */
  94.     short    rts_wildcard;        /* lookups satisfied by a wildcard */
  95. };
  96.  
  97. #ifdef KERNEL
  98. #define    RTFREE(rt) \
  99.     if ((rt)->rt_refcnt == 1) \
  100.         rtfree(rt); \
  101.     else \
  102.         (rt)->rt_refcnt--;
  103.  
  104. #ifdef    GATEWAY
  105. #define    RTHASHSIZ    64
  106. #else
  107. #define    RTHASHSIZ    8
  108. #endif
  109. #if    (RTHASHSIZ & (RTHASHSIZ - 1)) == 0
  110. #define RTHASHMOD(h)    ((h) & (RTHASHSIZ - 1))
  111. #else
  112. #define RTHASHMOD(h)    ((h) % RTHASHSIZ)
  113. #endif
  114. struct    mbuf *rthost[RTHASHSIZ];
  115. struct    mbuf *rtnet[RTHASHSIZ];
  116. struct    rtstat    rtstat;
  117. #endif
  118.  
  119. #endif _ROUTE
  120. @
  121.  
  122.  
  123. 1.1
  124. log
  125. @Initial revision
  126. @
  127. text
  128. @d15 3
  129. d91 2
  130. @
  131.